﻿<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="referrer" content="never">
    <title>art-template list</title>
    <script src="asset/js/template-web.js"></script>
</head>

<body>
    <div id="content"></div>
    <script id="test" type="text/html">

        <h1></h1>
        <ul>
            {{each news item index}}
            <li><img src="https://pic3.zhimg.com/{{item.ImageUrl}}" />{{item.Title}}</li>
            {{/each}}
        </ul>
    </script>
    <script src="http://cdn.bootcss.com/zepto/1.1.4/zepto.min.js" type="text/javascript"></script>
    <script>
        $(document).ready(function () {
            //var openid = getCookie("myOpenId");

            $.ajax({
                url: "api/article",
                dataType: "application/json",
                type: "GET",
                error: function (data) {
                    console.log("Server occurred error.")
                },
                success: function (result) {
                    var data = JSON.parse("{\"news\":" + result + "}");
                    var html = template('test', data);
                    $("#content").html(html);
                    
                }
            });
        });
    </script>
</body>
</html>